layui.use(['jquery'], function() {
    const $ = layui.jquery;

    // 左侧栏伸缩
    $('[layadmin-event="flexible"]').click(function () {
        $('#LAY-app').toggleClass('layadmin-side-shrink')
    });

    // 页面刷新
    $('[layadmin-event="refresh"]').click(function () {
        location.reload();
    });

    // 全屏
    $('[layadmin-event="fullscreen"]').click(function () {
        if (!$('body').hasClass('full-screen')) {
            const l = document.body;
            l.webkitRequestFullScreen ? l.webkitRequestFullScreen() : l.mozRequestFullScreen ? l.mozRequestFullScreen() : l.requestFullScreen();
            $('body').addClass('full-screen');
        } else {
            const l = document;
            l.webkitCancelFullScreen ? l.webkitCancelFullScreen() : l.mozCancelFullScreen ? l.mozCancelFullScreen() : l.cancelFullScreen();
            $('body').removeClass('full-screen');
        }
    });
});
